package com.heima.admin.job;

import com.heima.admin.feign.WemediaFeign;
import com.heima.admin.service.WemediaNewsAutoScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    WemediaFeign wemediaFeign;

    @Autowired
    WemediaNewsAutoScanService wemediaNewsAutoScanService;

    @XxlJob("wmNewsAutoScan")
    public ReturnT<String> wmNewsAutoScanJob(String param) throws Exception {
        List<Integer> ids = wemediaFeign.findRelease();
        for (Integer id : ids) {
            wemediaNewsAutoScanService.autoScanByMediaNewsId(id);
        }
        return ReturnT.SUCCESS;
    }
}